
<template>
  <div o-Container>
    <o-list v-bind:source="list.datasource"
            v-bind="{created:create,modified:modify,deleted:del,searched:search}"/>
    <!--    老是喜欢新增数据源，先用完，再开放了-->
    <!--    v-bind="{created:create,exported:output,viewed:view,modified:modify,deleted:del,searched:search}"/>-->
  </div>
</template>

<script>
  export default {
    name: "mms_engine_datasource_list", /* 这个name暂时不知道用啥用，根据官方文档说的是方便排错的 */
    data() {
      return {
        octopus: this.$parent.octopus,
        list: {
          datasource: {
            data: {
              id: 19, // 八爪鱼ID
              // orderData: "DatabaseID DESC,Name ASC",
              cellData: [
                {name: "ID", searchKey: "=", width: 50,},
                {name: "DatabaseID", searchKey: "=", width: 130}, //数据库id
                {name: "Name", searchKey: "Like", width: 270},
                {name: "Query", searchKey: "Like", width: 770},
                {name: "PrimaryKey", searchKey: "Like", width: 60},
                {name: "OrderData", width: "150"},
                {name: "IsPartition", searchKey: "=", width: 60},
                {name: "CreatorID", width: "70"}, //创建id
                {name: "CreateDate", width: "150"}, //创建时间
                {name: "UpdaterID", width: "70", searchKey: "="}, //修改id
                {name: "UpdateDate", width: "150"}, //修改时间
                {name: "Note", width: 300}, //文本
              ],
            }
          },
        }
      }
    },
    methods: {
      create: function () {
        this.octopus.router.jump("/MMS/Engine/Datasource/Modify");
      },
      output: function (data) {
        // 导出以后，回调这里给客户端操作。
        // 核心思想是cellData包含search数据（不管有没有），回传以后发送export指令，后台api会直接返回导出的数据提供下载。
        alert("export: get cell data is " + JSON.stringify(data));  //提示
      },
      search: function (cell) {
        // console.log("search:" + JSON.stringify(cell));
      },
      modify: function (row) {
        this.octopus.router.jump("/MMS/Engine/Datasource/Modify?id=" + row.ID);
      },
      view: function (row) {
        alert("view key: " + JSON.stringify(row));
      },
      del: function (row) {
        alert("del key: " + JSON.stringify(row));
      },
    },
    props: ["oData"]
  }
</script>

